<?php

/**
 * 进行初始化操作
 * */
date_default_timezone_set("Asia/Shanghai");
require_once dirname(__FILE__) . '/config/ConfigLoader.php';
global $_GCONFIG;
global $TableNodeArrayHeaderArray;
global $TableSensorDataHeaderArray;
/**
 * 全局变量声明
 */
global $_G;

// var_dump($_GET);

session_start();

require_once dirname(dirname(__FILE__)) . '/function/function_core.php';
require_once dirname(__FILE__) . '/database/DBManager.php';
require_once getTablesFile() . "/table_application_sensorData.php";
require_once getTablesFile() . "/table_application_nodeArray.php";
require_once getTablesFile() . "/table_application_nodelocalinfo.php";

if ($_GET['query'] == "查询数据") {
    if ($_GET['tableName'] == 'nodearray') {
        require_once dirname(__FILE__) . '/database/NodeInfoArray.php';
    } else if ($_GET['tableName'] == 'sensordata') {
        require_once dirname(__FILE__) . '/database/SensorDataFilter.php';
    } else if ($_GET['tableName'] == 'nodelocalinfo') {
        require_once dirname(__FILE__) . '/database/NodeLocalInfo.php';
    }
} else if ($_GET['query'] == "下载数据") {
    require_once dirname(__FILE__) . '/database/toCSV.php';
}





// echo "<pre>";
// print_r($data1);
// echo "<pre>";
// echo "</br>";
// echo "<pre>";
// print_r($data2);
// echo "<pre>";
